package me.xingyannian.hope.service.impl;

import me.xingyannian.hope.entity.Role;
import me.xingyannian.hope.repository.RoleRepository;
import me.xingyannian.hope.service.RoleService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    private RoleRepository roleRepository;

    public RoleServiceImpl(RoleRepository roleRepository) {
        this.roleRepository = roleRepository;
    }

    @Override
    public Role create(Role role) {
        return this.roleRepository.save(role);
    }

    @Override
    public List<Role> getAllRole() {
        return this.roleRepository.findAll();
    }
}
